package com.qingzhuge.member.enums;

import com.qingzhuge.common.IBaseEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : cq
 */
public enum EnumPublishType implements IBaseEnum<Integer> {

    /**软文*/
    SOFT_ARTICLE(0),
    /**基本信息*/
    INFO(1),
    /**通知*/
    INFORM(2),
    /**规章要求*/
    REQUIRE(3);

    private final Integer value;
    private final static Map<String, EnumPublishType> VALUE_CACHE = new HashMap<>();

    static {
        for (EnumPublishType c : values()) {
            VALUE_CACHE.put(c.name(), c);
        }
    }

    EnumPublishType(Integer value) {
        this.value = value;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    public static EnumPublishType fromValue(String value) {
        return VALUE_CACHE.get(value);
    }

    @Override
    public String toString() {
        return this.name();
    }
}
